﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SalePartial.IDAL;
using System.Data.SqlClient;
using SalePartial.Model;

namespace SalePartial.BLL
{
    public class XPNewsComment : IXPNewsComment
    {
        private IXPNewsComment dal = SalePartial.DALFactory.DataAccess.CreateXPNewsComment();

        public void Delete(XPNewsCommentInfo coInfo)
        {
            dal.Delete(coInfo.CoID);
        }

        public XPNewsCommentInfo GetXPNewsComment(Guid id)
        {
            SqlDataReader reader = this.SelectReader(id);
            if (reader.Read())
            {
                XPNewsCommentInfo info = new XPNewsCommentInfo(reader);
                if (!reader.IsClosed)
                {
                    reader.Close();
                }
            
                return info;
            }
            return null;

        }


        public int Delete(Guid CompanyID)
        {
            return dal.Delete(CompanyID);
        }

        public int DeleteDynamic(string v_whereCondition)
        {
            return dal.DeleteDynamic(v_whereCondition);
        }

        public int Insert(XPNewsCommentInfo info)
        {
            return dal.Insert(info);
        }

        public System.Data.DataSet SelectAll()
        {
            return dal.SelectAll();
        }

        public SqlDataReader SelectByNewsID(Guid NewsID)
        {
            return dal.SelectByNewsID(NewsID);
        }

        public XPNewsCommentInfo SelectByCoID(Guid CoID)
        {
            return dal.SelectByCoID(CoID);
        }


        public System.Data.DataSet SelectDynamic(string v_whereCondition, string v_orderByExpression)
        {
            return dal.SelectDynamic(v_whereCondition, v_orderByExpression);
        }

        public System.Data.DataSet SelectPaged()
        {
            return dal.SelectPaged();
        }

        public System.Data.SqlClient.SqlDataReader SelectReader(Guid CompanyID)
        {
            return dal.SelectReader(CompanyID);
        }

        public int Update(XPNewsCommentInfo info)
        {
            return dal.Update(info);
        }
    }

}
